package rmi;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.List;
import java.util.Map;

import document.DocInfo;
import document.DocPermissions;

import messagepasser.UserInfo;

public interface Server extends Remote{
	public UserInfo login (String user, String password, String ipAddr, int port) throws RemoteException;
	public List<DocInfo> getDocuments (int userId)  throws RemoteException;
	public List<UserInfo> getonlineUsers (int userId)  throws RemoteException;
	public void register (Client c, int userid) throws RemoteException;
	public DocPermissions[] getDocUsers (int docId) throws RemoteException;
	public void logout (UserInfo user)  throws RemoteException;
// Create Doc
	public int createDoc (int userid, String docname, String desc) throws RemoteException;
	// Save doc
	public void saveDoc(int userid, int docid, String contents) throws RemoteException;
	// Edit Doc
	public String editdoc(int docid) throws RemoteException;
	// Share Doc
	public DocPermissions[] shareDoc(int userid, int docid) throws RemoteException;
	//Insert Permission
	public void insertPermission(int docid, int userid, String accesstype, int senderId) throws RemoteException;
	//Remove Permission
	public void removePermission(int docid, int userid) throws RemoteException;
	// back up server synch
	public void syncClients(Map<Integer, Client> onlineUsers) throws RemoteException;
	//Create new User
	public Boolean createUser(String username, String fname, String lname, String pwd) throws RemoteException;
	
	//added for telling a client that another client wnts to chat with him
	public void regForChat (UserInfo  userSrc, UserInfo userDest, String type)  throws RemoteException;
	
}
